﻿<!DOCTYPE html>
<!--[if lte IE 8]>              <html class="ie8 no-js" lang="en">     <![endif]-->
<!--[if IE 9]>					<html class="ie9 no-js" lang="en">     <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html class="not-ie no-js" lang="en">
<!--<![endif]-->
<head>
    <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz|Open+Sans:400,600,700|Oswald|Electrolize' rel='stylesheet' type='text/css' />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

    <title>Car Dealer | Home</title>

    <meta name="description" content="" />
    <meta name="author" content="" />

    <link rel="shortcut" href="images/favicon.ico" />
    <link rel="stylesheet" href="css/style.css" media="screen" />
    <link rel="stylesheet" href="css/skeleton.css" media="screen" />
    <link rel="stylesheet" href="sliders/flexslider/flexslider.css" media="screen" />
    <link rel="stylesheet" href="fancybox/jquery.fancybox.css" media="screen" />
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <!-- HTML5 Shiv + detect touch events -->
    <script type="text/javascript" src="js/modernizr.custom.js"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style>
        fieldset label {
            width: 55px;
        }
        #navigation ul li button{
            height:55px;
            background-color:transparent;
        }

    </style>

</head>

<body class="menu-1 h-style-1 text-1">

    <div class="wrap">

        <!-- - - - - - - - - - - - - - Header - - - - - - - - - - - - - - - - -->

        <header id="header" class="clearfix">
            <div style="">


                <a href="index.html" id="logo"><img src="images/logo.png" alt="Car Dealer" /></a>
            </div>


            <div class="widget-container widget_search" style="">

                <span class="call"><span>（+86）</span> 18888888888</span><br />

                <span class="adds">北京市海淀区上地七街北京八维研修学院软工教学楼38404</span>

                <form action="#" id="searchform" method="get">

                <p>
                    <input type="text" id="s" placeholder="Search" />
                    <button type="submit" id="searchsubmit"></button>
                </p>

                <!--/ #searchform-->
               </form>
            </div><!--/ .widget-container-->

            <nav id="navigation" class="navigation">

                <ul>




                    <li class="current-menu-item"><a href="index.html" class="active">首页</a></li>
                    <li>
                        <!--<a href="all-listings.html">买车</a>-->
                        <a href="all-listings.html">买车</a>
                    </li>
                    <li>
                        <a href="blog.html">博客</a>
                        <ul>
                            <li><a href="blog.html">博客</a></li>
                            <li><a href="blog-single.html">博客单</a></li>
                        </ul>
                    </li>
                    <li>
                        <a href="news1.html">新闻</a>
                        <ul>
                            <li><a href="news1.html">新闻时事</a></li>
                            <li><a href="image-and-floats.html">新车上市</a></li>
                        </ul>
                    </li>
                    <li><a href="sales-reps.html">销售代表</a></li>
                    
                    <li><a href="contact.html">联系人</a></li>
                    
                    <li>
                        <a href="#" style="text-decoration:none" data-toggle="modal" onclick="SallCar(0)"  data-target="#SallCar">我要卖车</a>
                    </li>
                    <li style="float:right">
                        <button  id="bt1" class="btn  btn-lg" data-toggle="modal" data-target="#myModal">登陆</button>
                        <button  class="btn  btn-lg" data-toggle="modal" data-target="#Modal">注册</button>
                        <button  id="bt2" class="btn  btn-lg" data-toggle="modal" data-target="#tuiModal">安全退出</button>

<!--                        <button  class="btn  btn-lg" onclick="tui()">安全退出</button>-->
                    </li>

                </ul>

            </nav><!--/ #navigation-->

        </header><!--/ #header-->

        <div class="copyrights">Collect from <a href="http://www.cssmoban.com/">Website Template</a></div>
        <!-- - - - - - - - - - - - - - end Header - - - - - - - - - - - - - - - - -->
        <!-- - - - - - - - - - - - - - Top Panel - - - - - - - - - - - - - - - - -->

        <div class="top-panel clearfix">

            <!-- - - - - - - - - - - Slider - - - - - - - - - - - - - -->

            <div id="slider" class="flexslider clearfix">

                <ul class="slides">

                    <li>

                        <img src="images/sliders/slide-1.jpg" alt="" />

                        <div class="caption">
                            <div class="caption-entry">

                                <dl class="auto-detailed clearfix">
                                    <dt><span class="model">大众CC 2015款 2.0TSI 至尊型</span></dt>
                                    <dd class="media-hidden"><b>2.0T 中型车</b></dd>
                                    <dd class="media-hidden"><b>73000 公里</b></dd>
                                    <dd><span class="heading">¥227000</span></dd>
                                </dl><!--/ .auto-detailed-->

                                <a href="#" class="button orange">Details &raquo;</a>

                            </div><!--/ .caption-entry-->
                        </div><!--/ .caption-->
                    </li>
                    <li>
                        <img src="images/sliders/slide-2.jpg" alt="" />

                        <div class="caption">
                            <div class="caption-entry">

                                <dl class="auto-detailed clearfix">
                                    <dt><span class="model">宝马X1 2013款 sDrive18i 时尚型</span></dt>
                                    <dd class="media-hidden"><b>2.0L SUV</b></dd>
                                    <dd class="media-hidden"><b>33100 公里</b></dd>
                                    <dd><span class="heading">¥193100</span></dd>
                                </dl><!--/ .auto-detailed-->

                                <a href="#" class="button orange">Details &raquo;</a>

                            </div><!--/ .caption-entry-->
                        </div><!--/ .caption-->
                    </li>
                    <li>
                        <img src="images/sliders/slide-3.jpg" alt="" />

                        <div class="caption">
                            <div class="caption-entry">

                                <dl class="auto-detailed clearfix">
                                    <dt><span class="model">福特蒙迪欧 2017款 EcoBoost 180 豪华型</span></dt>
                                    <dd class="media-hidden"><b>1.5L 中型车</b></dd>
                                    <dd class="media-hidden"><b>7500 公里</b></dd>
                                    <dd><span class="heading">¥178000</span></dd>
                                </dl><!--/ .auto-detailed-->

                                <a href="#" class="button orange">Details &raquo;</a>

                            </div><!--/ .caption-entry-->
                        </div><!--/ .caption-->
                    </li>
                    <li>
                        <img src="images/sliders/slide-4.jpg" alt="" />

                        <div class="caption">
                            <div class="caption-entry">

                                <dl class="auto-detailed clearfix">
                                    <dt><span class="model">哈弗H6 2015款 运动版 1.5T 自动两驱豪华型</span></dt>
                                    <dd class="media-hidden"><b>1.5L 紧凑型SUV</b></dd>
                                    <dd class="media-hidden"><b>33900 公里</b></dd>
                                    <dd><span class="heading">¥97000</span></dd>
                                </dl><!--/ .auto-detailed-->

                                <a href="#" class="button orange">Details &raquo;</a>

                            </div><!--/ .caption-entry-->
                        </div><!--/ .caption-->
                    </li>
                    <li>
                        <img src="images/sliders/slide-5.jpg" alt="" />

                        <div class="caption">
                            <div class="caption-entry">

                                <dl class="auto-detailed clearfix">
                                    <dt><span class="model">奔驰C级 2015款 改款 C 200 L 运动型</span></dt>
                                    <dd class="media-hidden"><b>2.0T 中型车</b></dd>
                                    <dd class="media-hidden"><b>13200 公里</b></dd>
                                    <dd><span class="heading">¥310000</span></dd>
                                </dl><!--/ .auto-detailed-->

                                <a href="#" class="button orange">Details &raquo;</a>

                            </div><!--/ .caption-entry-->
                        </div><!--/ .caption-->
                    </li>

                </ul><!--/ .slides-->

            </div><!--/ #slider-->
            <!-- - - - - - - - - - - end Slider - - - - - - - - - - - - - -->
            <!-- - - - - - - - - - - Search Panel - - - - - - - - - - - - - -->

            <div class="widget_custom_search">

                <h3 class="widget-title">快速搜索</h3>

                <form action="/" id="boxpanel" class="form-panel" >
                <table>
                    <tr>
                        <th><label style="display:inline-block" for="manufacturer">汽车品牌:</label></th>
                        <td><input type="text" id="GoodsPai" /></td>
                    </tr>
                    <tr>
                        <th><label style="display:inline-block" for="minprice">最低价格:</label></th>
                        <td><input type="text" id="MinPrice" /></td>
                    </tr>
                    <tr>
                        <th><label style="display:inline-block" for="maxprice">最高车价:</label></th>
                        <td><input type="text" id="MaxPrice" /></td>
                    </tr>
                    <tr>
                        <th><label style="display:inline-block" for="mileage">&nbsp;&nbsp;里程:</label></th>
                        <td><input type="text" id="GoodsMileage" /></td>
                    </tr>
                    <tr>
                        <th><label style="display:inline-block" for="bodytype">&nbsp;&nbsp;车型:</label></th>
                        <td>
                            <select id="CarsModel">
                                <option value="0">请选择</option>
                            </select>

                        </td>
                    </tr>

                </table>

                <div class="clear"></div>
                <button id="submitSearch" class="submit-search" type="button" onclick="cha()">搜索</button>

                </form><!--/ .form-panel-->

            </div><!--/ .main-search-panel-->
            <!-- - - - - - - - - - end Search Panel - - - - - - - - - - - - -->

        </div><!--/ .top-panel-->
        <!-- - - - - - - - - - - - - end Top Panel - - - - - - - - - - - - - - - -->

        <div class="main">

            <!-- - - - - - - - - - - - - - - Container - - - - - - - - - - - - - - - - -->

            <section class="container sbr clearfix">

                <!-- - - - - - - - - - - - - - - Content - - - - - - - - - - - - - - - - -->

                <section id="content" class="twelve columns">

                    <div class="recent-list-cars">

                        <h3 class="widget-title">我的汽车</h3>

                        <ul class="clearfix" id="count"></ul>

                        <a href="all-listings.html" class="see">See all automobiles</a>

                    </div><!--/ .recent-list-cars-->

                </section><!--/ #content-->
                <!-- - - - - - - - - - - - - - end Content - - - - - - - - - - - - - - - - -->
                <!-- - - - - - - - - - - - - - - Sidebar - - - - - - - - - - - - - - - - -->



            </section><!--/.container -->
            <!-- - - - - - - - - - - - - end Container - - - - - - - - - - - - - - - - -->

        </div><!--/ .main-->
        <!-- - - - - - - - - - - - - - - Footer - - - - - - - - - - - - - - - - -->

        <footer id="footer" class="container clearfix">

            <section class="container clearfix">

                <div class="four columns">

                    <div class="widget-container widget_text">

                        <h3 class="widget-title">关于我们</h3>

                        <div class="textwidget">

                            <p class="white">
                                我们是专业的二手车在线交易服务提供商。
                            </p>

                            <p>
                                我们的核心业务涵盖了二手车网络交易、二手车电商零售平台，以及二手车金融衍生服务。我们集团致力于为中国二手车行业的发展做出贡献，利用互联网及移动互联网技术，推动和建立中国未来二手车市场的诚信与高效。
                            </p>

                        </div><!--/ .textwidget-->

                        <a href="#" class="see">阅读更多</a>

                    </div><!--/ .widget-container-->

                </div><!--/ .four .columns-->

                <div class="four columns">

                    <div class="widget-container widget_text">

                        <h3 class="widget-title">我们的时间</h3>

                        <div class="textwidget">

                            <ul class="hours">

                                <li>星期一 <span>8 上午 到 7 下午</span></li>
                                <li>星期二 <span>8 上午 到 9 下午</span></li>
                                <li>星期三 <span>8 上午 到 9 下午</span></li>
                                <li>星期四 <span>8 上午 到 9 下午</span></li>
                                <li>星期五 <span>8 上午 到 9 下午</span></li>
                                <li>星期六 <span>8 上午 到 9 下午</span></li>
                                <li>星期日 <span>休息</span></li>

                            </ul><!--/ .hours-->

                        </div><!--/ .textwidget-->

                    </div><!--/ .widget-container-->

                </div><!--/ .four .columns-->

                <div class="four columns">

                    <div class="widget-container widget_contacts">

                        <h3 class="widget-title">我们的联系人</h3>

                        <ul class="our-contacts">

                            <li class="address">
                                <b>地址：</b>
                                <p>北京市海淀区上地七街</p>
                            </li>
                            <li class="phone">
                                <b>电话:</b>&nbsp;<span>18611306272</span> <br />
                                <b>QQ在线客服:</b><br />
                                <b><img src="images/QQ图片20170417184407.jpg" width="15" height="15" border=0 ><a class='qqb' href='tencent://message/?uin=1798316088&Site=心殤的狼，卻痛入骨髓&Menu=yes'>技术QQ:</a></b><br />
                                <b><img src="images/QQ图片20170417184407.jpg" width="15" height="15" border=0 ><a class='qqb' href='tencent://message/?uin=1007762278&Site=*一杯烈酒&Menu=yes'>业务QQ:</a></b>

                            </li>
                            <li>
                                <b><a target="_blank" href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=IBEXGRgTERYQGBhgUVEOQ09N" style="text-decoration:none;">给我写信</a></b><br />

                                <b><a target="_blank" href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=IBEXGRgTERYQGBhgUVEOQ09N" style="text-decoration:none;"><img src="http://rescdn.qqmail.com/zh_CN/htmledition/images/function/qm_open/ico_mailme_12.png" /></a></b>

                            </li>

                        </ul><!--/ .our-contacts-->

                    </div><!--/ .widget-container-->

                </div><!--/ .four .columns-->

                <div class="four columns">

                    <div id="gMap"></div>

                </div><!--/ .four .columns-->

                <div class="adjective clearfix">

                    <p class="copyright">版权所有 &copy; 2013. 第二项目组 </p>

                </div><!--/ .adjective-->

            </section><!--/ .container-->

        </footer><!--/ #footer-->
        <!-- - - - - - - - - - - - - - - end Footer - - - - - - - - - - - - - - - - -->

    </div><!--/ .wrap-->
    <!-- 模态框（Modal登陆） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <!-- 模态框内容 -->
            <div class="modal-content">
                <!-- 模态框头 -->
                <div class="modal-header">
                    <!-- 关闭模态框 -->
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <!-- 模态框标题 -->
                    <h3 class="modal-title" id="myModalLabel">
                        登陆 <a data-dismiss="modal" data-toggle="modal" data-target="#Modal">注册</a>
                    </h3>
                </div>
                <!-- 模态框填写内容 -->
                <div class="modal-body">
                    <h3 style="padding-top: 20px; padding-bottom: 20px; padding-left: 20px;"><b>账户登录</b></h3>

                    <span class="glyphicon glyphicon-user" style="margin-left: 20px;"></span>
                    <input type="text" class="inputclass" id="zhanghu" name="zhanghu" placeholder="手机" /><br />
                    <span class="glyphicon glyphicon-lock" style="margin-left: 20px;"></span>
                    <input type="password" class="inputclass" id="pwd" name="pwd" placeholder="密码" /><br />
                    <input id="Checkbox1" type="checkbox" style="margin-left: 20px;" />记住密码<br />
                    <button type="button" class="btn btn-default " id="button1" data-dismiss="modal" onclick="login()">登陆</button>
                    <h4 style="padding-top: 40px; padding-bottom: 10px; padding-left: 20px;">忘记密码？</h4>
                    <h5 style="padding-top: 20px; padding-bottom: 20px; padding-left: 20px;">别担心，点击<a href="#">这里</a>重置密码</h5>
                    <h5 style="padding-top: 20px; padding-bottom: 20px; padding-left: 20px;">还没有用户？<a href="#" data-target="#Modal">注册新用户</a></h5>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default " data-dismiss="modal">退出</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
    <!-- 模态框（Modal）（注册） -->
    <div class="modal fade" id="Modal" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <!-- 模态框内容 -->
            <div class="modal-content">
                <!-- 模态框头 -->
                <div class="modal-header">
                    <!-- 关闭模态框 -->
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <!-- 模态框标题 -->
                    <h3 class="modal-title" id="myModalLabel1">
                        注册 <a data-dismiss="modal" data-toggle="modal" data-target="#myModal">登陆</a>
                    </h3>
                </div>

                <!-- 模态框填写内容 -->
                <div class="modal-body">
                    <h3 style="padding-top: 20px; padding-bottom: 20px; padding-left: 20px;"><b>注册新用户</b></h3>
                    <p style="padding-left: 20px;">请输入个人信息：</p>
                    <span class="glyphicon glyphicon-envelope" style="margin-left: 20px;"></span>
                    <input type="text" class="inputclass" id="phone" name="phone" placeholder="手机" />
                    <input id="id" type="button" onclick="downLoad(this)" name="id" value="获取验证码" /><br />
                    <span class="glyphicon glyphicon-envelope" style="margin-left: 20px;"></span>
                    <input type="text" class="inputclass" id="yan" name="yan" placeholder="验证码" /><br />
                    <p style="padding-left: 20px;">请输入账户信息：</p>
                    <span class="glyphicon glyphicon-lock" style="margin-left: 20px;"></span>
                    <input type="password" class="inputclass" id="upwd" name="upwd" placeholder="密码" /><br />
                    <span class="glyphicon glyphicon-ok" style="margin-left: 20px;"></span>
                    <input type="password" class="inputclass" id="upwd1" name="npwd" placeholder="确认密码" /><br />
                    <input id="Checkbox2" type="checkbox" style="margin-left: 20px;" />我同意<a href="#">服务条款</a>和<a href="#">隐私政策</a><br />
                    <br />
                    <button type="button" id="button2" class="btn btn-default " onclick="o()">注册</button>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default " data-dismiss="modal">退出</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->

    <!-- 模态框（Modal）（安全退出） -->
    <div class="modal fade" id="tuiModal" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <!-- 模态框内容 -->
            <div class="modal-content">
                <!-- 模态框头 -->
                <div class="modal-header">
                    <!-- 关闭模态框 -->
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <!-- 模态框标题 -->
                    <h3 >
                        安全退出 
                    </h3>
                </div>
                <!-- 模态框填写内容 -->
                <div class="modal-body">
                    <h3>确定退出吗？</h3>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default " onclick="tui()" data-dismiss="modal">确定</button>
                    <button type="button" class="btn btn-default " data-dismiss="modal">取消</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>


        <div class="modal fade" id="SallCar" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <!-- 模态框内容 -->
            <div class="modal-content">
                <!-- 模态框头 -->
                <div class="modal-header">
                    
                    <!-- 关闭模态框 -->
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 class="modal-title" >我要卖车</h3>
                    <!-- 模态框标题 -->
                </div>
                <!-- 模态框填写内容 -->
                <div class="modal-body">
                                    <table>
                    <tr>
                        <td>车子品牌</td>
                        <td>                            
                            <select id="Select1">
                                <option value="0">请选择</option>

                            </select>
                        </td>
                    </tr>
                       
                    <tr>
                        <td>车子系列</td>
                        <td>
                            <select id="Select2">
                                <option value="0">请选择</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                    </tr>
                    <tr>
                    </tr>
                    <tr>
                    </tr>

                </table>











                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default " data-dismiss="modal">退出</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>


    <script src="js/jquery-1.10.2.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/jquery-1.10.2.min.js"><\/script>')</script>
    <!--[if lt IE 9]><\/script>
        <script src="js/selectivizr-and-extra-selectors.min.js"></script>
    <![endif]-->
    <script src="sliders/flexslider/jquery.flexslider-min.js"></script>
    <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script src="js/jquery.gmap.min.js"></script>
    <script src="js/custom.js"></script>


</body>
</html>
<script>

    $(function () {
        $("#Select1").change(function () {
            var c = $("#Select1").val();
            if (c != 0) {
                $.ajax({
                    type: "get",
                    url: "http://localhost:5819/api/CarsType/GetCarsTypeList",
                    data: {
                        id: c
                    },
                    success: function (msg) {
                        var selectval = "";
                        $("#Select2").html("");
                        selectval += '<option value="0">请选择</option>'
                        for (var i = 0; i < msg.length; i++) {

                            selectval += '<option value="' + msg[i]["TypeID"] + '">' + msg[i]["TypeName"] + '</option>';

                        }
                        $("#Select2").append(selectval);
                    }
                })
            }
            else
            {
                $("#Select2").html('<option value="0">请选择</option>')
            }
        })
        var select = '';
        $.ajax({
            type: "get",
            url: "http://localhost:5819/api/CarsModels/GetCarsModelsShow",
            success: function (msg) {

                for (var i = 0; i < msg.length; i++) {
                    select += '<option value="' + msg[i]["CarsModelID"] + '">' + msg[i]["CarsModelName"] + '</option>';
                }
                $("#CarsModel").append(select);
            }
        })

        var q = window.localStorage;
        q.setItem("id", d);
        ///判断本用户的信息
        $.ajax({
            type: "get",
            url: "http://localhost:5819/api/Goods/GetSelectGoodsList",
            data: {
                Userid: 1
            },
            success: function (d) {
                var content = ' '
                $(d).each(function (i, j) {
                    content += '  <li> '
                    content += '   <a href="#" class="single-image video picture"> '
                    content += '       <img src="' + j.GoodsImage + '" alt="" /> '
                    content += '   </a> '
                    content += '   <a href="#" class="list-meta"> '
                    content += '     <h6 class="title-list-item">' + j.GoodsSet + '</h6> '
                    content += '  </a> '
                    content += '  <div class="detailed"> '
                    content += '    <span class="cost">¥' + j.GoodsPrice + '</span> '
                    content += '    <span>' + j.GoodsSet + '</span> <br /> '
                    content += '   <b>' + j.GoodsMileage + ' 公里</b> '
                    content += '    </div><!--/ .detailed--> '
                    content += '    <a onclick="bu()" class="button orange">Details</a> '
                    content += '  </li> '

                })
                $("#count").html(content);

            }
        })
        
    })

        
    //登陆
    function login() {
        var phone = $("#zhanghu").val();
        var pwd = $("#pwd").val();
        if (phone == "") {
            alert("手机号不能为空！");
        }
        else {
            if (pwd == "") {
                alert("密码不能为空！");


            }
            else {

                $.ajax({
                    type: "get",
                    url: "http://localhost:5819/api/Home/GetUsersLogin",
                    data: {
                        UsersNameorTel: phone,
                        UsersPwd: pwd
                    },
                    success: function (d) {
                        if (d > 0) {
                            alert("登陆成功！");

                            var q = window.localStorage;
                            q.setItem("id", d);
                            show(d);

                        }
                        if (d == -1) {
                            alert("用户不存在！");
                            return;
                        }
                        if (d == -2) {
                            alert("密码错误！");
                            return;
                        }
                        if (d == -3) {
                            alert("该用户已登录！");
                            return;
                        }



                    }

                })

            }
        }

    }
    //注册
    function o() {

        var phone = $("#phone").val();
        var upwd = $("#upwd").val();
        var upwd1 = $("#upwd1").val();
        if (phone == "") {
            alert("手机号码不能为空！");
            return;

        }
        var ph = /^[1]+[3,5,7,8]+\d{9}/
        if (!ph.test(phone)) {
            alert("手机号码不符合验证规则！");
            return;
        }

        if (upwd == "") {
            alert("密码不能为空！");
            return;
        }
        if (upwd1 == "") {
            alert("确认密码不能为空！");
            return;
        }
        if ($("#yan").val() == "") {
            alert("验证码不能为空！");
            return;
        }
        if (upwd == upwd1) {
            if ($("#Checkbox2").attr("checked", this.checked)) {
                $.ajax({
                    type: "post",
                    url: "Handler2.ashx",
                    data: {
                        t: $("#yan").val(),
                        zhi: yanzhi
                    },
                    success: function (r) {
                        if (r == 1) {
                            $.ajax({
                                type: "get",
                                url: "http://localhost:5819/api/Home/GetUsersRegist",
                                data: {
                                    UsersNameorTel: phone,
                                    UsersPwd: upwd

                                },


                                success: function (d) {
                                    alert(d);
                                    location.reload();
                                }

                            })
                        }
                        else {
                            alert("验证码有误，请从新输入！");
                        }
                    }
                })

                ////$.get("http://localhost:5819/api/Home/GetUsersRegist", { UsersNameorTel: "admin", UsersPwd: "admin" }, function (d) {
                //    alert(d);

                //})
            }

            else {
                alert("请阅读注册协议！");
            }
        }
        else {
            alert("密码和确认密码不同！");
        }
    }
    //判断有没有登陆
    function bu() {
        var q = window.localStorage;
        id = q.getItem("id");

        if (id > 0) {
            location.href = "all-listings.html"
            q.clear();


        }
        else {
            alert("您还没有登陆");



        }

    }
    //快速查询
    function cha() {
        var GoodsPai = $("#GoodsPai").val();
        var MinPrice = $("#MinPrice").val();
        var MaxPrice = $("#MaxPrice").val();
        var GoodsMileage = $("#GoodsMileage").val();
        var CarsModel = $("#CarsModel").val();
        if (GoodsPai == "") {
            alert("品牌不能为空！");
            return;

        }
        if (MinPrice == "") {
            alert("最低价不能为空！");
            return;

        }
        if (MaxPrice == "") {
            alert("最高价不能为空！");
            return;

        }

        if (GoodsMileage == "") {
            alert("行驶里程不能为空！");
            return;

        }
        if (CarsModel == "") {
            alert("车型不能为空！");

        }

        else {
            $.ajax({
                type: "get",
                url: "http://localhost:5819/api/Goods/GetSelectGoodsList",
                data: {
                    GoodsType: GoodsPai,
                    MinPrice: MinPrice,
                    MaxPrice: MaxPrice,
                    GoodsMileage: GoodsMileage,
                    CarsModel: CarsModel

                },
                success: function (d) {
                    var content = ' '
                    $(d).each(function (i, j) {
                        content += '  <li> '
                        content += '   <a href="#" class="single-image video picture"> '
                        content += '       <img src="' + j.GoodsImage + '" alt="" /> '
                        content += '   </a> '
                        content += '   <a href="#" class="list-meta"> '
                        content += '     <h6 class="title-list-item">' + j.GoodsSet + '</h6> '
                        content += '  </a> '
                        content += '  <div class="detailed"> '
                        content += '    <span class="cost">¥' + j.GoodsPrice + '</span> '
                        content += '    <span>' + j.GoodsType + '</span> <br /> '
                        content += '   <b>' + j.GoodsMileage + ' 公里</b> '
                        content += '    </div><!--/ .detailed--> '
                        content += '    <a onclick="bu()" class="button orange">Details</a> '
                        content += '  </li> '

                    })
                    $("#count").html(content);
                    location.reload();
                }

            })



        }

    }

    function show(id) {
        $.ajax({
            type: "get",
            url: "http://localhost:5819/api/Goods/GetSelectGoodsList",
            data: {
                Userid: id
            },
            success: function (d) {
                var content = ' '
                $(d).each(function (i, j) {
                    content += '  <li> '
                    content += '   <a href="#" class="single-image video picture"> '
                    content += '       <img src="' + j.GoodsImage + '" alt="" /> '
                    content += '   </a> '
                    content += '   <a href="#" class="list-meta"> '
                    content += '     <h6 class="title-list-item">' + j.GoodsSet + '</h6> '
                    content += '  </a> '
                    content += '  <div class="detailed"> '
                    content += '    <span class="cost">¥' + j.GoodsPrice + '</span> '
                    content += '    <span>' + j.GoodsType + '</span> <br /> '
                    content += '   <b>' + j.GoodsMileage + ' 公里</b> '
                    content += '    </div><!--/ .detailed--> '
                    content += '    <a onclick="bu()" class="button orange">Details</a> '
                    content += '  </li> '

                })
                $("#count").html(content);

            }
        })

    }
    ///安全退出
    function tui() {
        var q = window.localStorage;

        $.ajax({
            type: "get",
            url: "http://localhost:5819/api/Home/GetUsersExit",
            data: {
                UsersID: q.getItem("id")
            },
            success: function (d) {
                alert(d);
                location.reload();
            }


        })
    }
    var yanzhi = "";
    var countdown = 60;
    function downLoad(obj) {
        if (countdown == 60) {
            $.ajax({
                type: "post",
                url: "Handler1.ashx",
                data: {
                    t: $("#Text1").val()
                },
                success: function (r) {
                    yanzhi = r;
                    if (r != "") {
                        alert("验证码已发送！");
                    }
                }
            })
        }
        if (countdown == 0) {
            obj.removeAttribute("disabled");
            obj.value = "免费获取验证码";
            countdown = 60;
            return;
        }
        else {
            obj.setAttribute("disabled", true);
            obj.value = "重新发送(" + countdown + ")";
            countdown--;
        }
        setTimeout(function () {
            downLoad(obj)
        }, 1000)

    }






    //$(function () {
    //    SallCar(0)
    //    var b = $("#Select1").val();
    //    $("#Select1").change(function () {
    //        var c = $("#Select1").val();
    //        $.ajax({
    //            type: "get",
    //            url: "http://localhost:5819/api/CarsType/GetCarsTypeList",
    //            data: {
    //                id: c
    //            },
    //            success: function (msg) {
    //                for (var i = 0; i < msg.length; i++) {
    //                    selectval += '<option value="' + msg[i]["TypeID"] + '">' + msg[i]["TypeName"] + '</option>';

    //                }
    //            }
    //        })lect
    //        $("#Se2").append(selectval);
    //    })
    //})
    function SallCar(j) {
        var selectval = "";
        $.ajax({
            type: "get",
            url: "http://localhost:5819/api/CarsType/GetCarsTypeList",
            data:{
                id:j
            },
            success: function (msg) {

                for (var i = 0; i < msg.length; i++) {
                    selectval += '<option value="' + msg[i]["TypeID"] + '">' + msg[i]["TypeName"] + '</option>';
                }
                $("#Select1").append(selectval);
            }
        })
    }
</script>
